package test4;

import java.io.FileInputStream;
import java.io.OutputStream;
import java.net.Socket;

public class server extends Thread {
    private Socket socket;

    public server(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        try{OutputStream ops = socket.getOutputStream();
            FileInputStream stream = new FileInputStream("C:\\1.1\\123.jpeg");

            byte[] bytes = stream.readAllBytes();
            ops.write(bytes);
            System.out.println(socket.getRemoteSocketAddress());
        stream.close();
        ops.close();
        }
        catch (Exception e){
            e.printStackTrace();
        }
    }
}
